﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
	xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:local="clr-namespace:Png.Silverlight.Controls"
    >
    
    <!-- Default style for Png.Silverlight.Controls.AutoExpander -->
    <Style TargetType="local:AutoExpandOver">
        <Setter Property="OpenOnHover" Value="true"/>
        <Setter Property="CloseOnHover" Value="true"/>
        <Setter Property="HoldOpenWhenFocused" Value="true"/>
        <Setter Property="OpenOnClick" Value="false"/>
        <Setter Property="CloseOnClick" Value="true"/>
        <Setter Property="OpenOnFocus" Value="false"/>
        <Setter Property="OpenDelay" Value="100"/>
        <Setter Property="MakeModal" Value="true"/>
        <Setter Property="CloseDelay" Value="200"/>
        <Setter Property="PopupEnabled" Value="true"/>
        <Setter Property="Header" Value="Header Text"/>
        <Setter Property="Content" Value="Content Text"/>
        <Setter Property="Width" Value="120"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:AutoExpandOver">
					<Grid x:Name="RootElement1" Background="Transparent" 
						MinHeight="{TemplateBinding MinHeight}"
						MaxHeight="{TemplateBinding MaxHeight}"
						Height="{TemplateBinding Height}">
						<Grid.Resources>
							<Style x:Key="HeaderStyle" TargetType="ContentControl">
								<Setter Property="Template">
									<Setter.Value>
										<ControlTemplate TargetType="ContentControl">
											<ContentPresenter Content="{TemplateBinding Content}"/>
										</ControlTemplate>
									</Setter.Value>
								</Setter>
							</Style>
							<Style x:Key="ContentStyle" TargetType="ContentControl">
								<Setter Property="Template">
									<Setter.Value>
										<ControlTemplate TargetType="ContentControl">
											<ContentPresenter Content="{TemplateBinding Content}"/>
										</ControlTemplate>
									</Setter.Value>
								</Setter>
							</Style>
						</Grid.Resources>
						<vsm:VisualStateManager.VisualStateGroups>
							<vsm:VisualStateGroup x:Name="CommonStates">
								<vsm:VisualState x:Name="Collapsed">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="PopupElement1" Storyboard.TargetProperty="(Popup.IsOpen)">
											<DiscreteObjectKeyFrame KeyTime="00:00:00">
												<DiscreteObjectKeyFrame.Value>
													<System:Boolean>False</System:Boolean>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="HeaderElement1" Storyboard.TargetProperty="(UIElement.Visibility)">
											<DiscreteObjectKeyFrame KeyTime="00:00:00">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Visible</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</vsm:VisualState>
								<vsm:VisualState x:Name="Expanded">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="PopupElement1" Storyboard.TargetProperty="(Popup.IsOpen)">
											<DiscreteObjectKeyFrame KeyTime="00:00:00">
												<DiscreteObjectKeyFrame.Value>
													<System:Boolean>True</System:Boolean>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="HeaderElement1" Storyboard.TargetProperty="(UIElement.Visibility)">
											<DiscreteObjectKeyFrame KeyTime="00:00:00">
												<DiscreteObjectKeyFrame.Value>
													<Visibility>Collapsed</Visibility>
												</DiscreteObjectKeyFrame.Value>
											</DiscreteObjectKeyFrame>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</vsm:VisualState>
							</vsm:VisualStateGroup>
						</vsm:VisualStateManager.VisualStateGroups>
						<Border x:Name="HeaderElement1" Width="{TemplateBinding Width}" Background="{TemplateBinding Background}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <ContentControl Height="{TemplateBinding Height}" Content="{TemplateBinding Header}" Style="{StaticResource HeaderStyle}" VerticalContentAlignment="Center"/>
						</Border>
						<Popup x:Name="PopupElement1" IsOpen="False">
							<Popup.OpacityMask>
								<SolidColorBrush Color="#02FFFFFF"/>
							</Popup.OpacityMask>
                            <Border x:Name="ContentElement1" Width="{TemplateBinding Width}" Background="{TemplateBinding Background}">
                                <ContentControl x:Name="ContentArea1" Content="{TemplateBinding Content}" Style="{StaticResource ContentStyle}"/>
                            </Border>
						</Popup>
					</Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
